package openrr;

import openrr.geom.Mesh;
import java.util.Vector;

//the DisplayManager holds the display list; a list of all meshes that should be rendered. 
public class DisplayManager {
	//a reference to the main game class
	public GameMain game;
	
	//the display list. It is a vector consisting of meshes, to which meshes are added when they need to be rendered
	public Vector<Mesh> displayList;
	
	//constructor. initializes the class
	public DisplayManager(GameMain gameMain)
	{
		game = gameMain;
		displayList = new Vector<Mesh>();
	}
	public void render()
	{
		//the render() function renders the display list. It successively calls the render() method of each of the meshes in the display list
		for(int i = 0; i < displayList.size(); i++)
		{
			displayList.get(i).render();
		}
	}
	//adds a mesh to the display list
	public void addMesh(Mesh mesh)
	{
		this.displayList.add(mesh);
	}
}
